﻿<UserControl x:Class="EQual.MainModule.Employees.EmployeesSelectionView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dg="http://schemas.microsoft.com/wpf/2008/toolkit" 
    xmlns:Model="clr-namespace:EQual.MainModule"    
 
    >
    <UserControl.Resources >
        <ObjectDataProvider x:Key="Employees" ObjectType="{x:Type Model:EmployeesProvider}" MethodName="GetEmployees" />
        
    </UserControl.Resources>
    <Grid>
        <dg:DataGrid Name="datagrid" ItemsSource="{Binding Path=ItemsCollection}" AutoGenerateColumns="False" RowEditEnding="datagrid_RowEditEnding" Background="Transparent">
            <dg:DataGrid.Columns >
                <dg:DataGridComboBoxColumn SelectedValueBinding="{Binding id}"                                            
                                           SelectedValuePath="id"
                                           DisplayMemberPath="id"
                                           Header="id"
                                           ItemsSource="{Binding Source={StaticResource Employees}}">
                    <dg:DataGridComboBoxColumn.EditingElementStyle>
                        <Style TargetType="ComboBox">
                            <Setter Property="IsEditable" Value="True" />
                        </Style>
                    </dg:DataGridComboBoxColumn.EditingElementStyle>
                </dg:DataGridComboBoxColumn>

                <dg:DataGridComboBoxColumn SelectedValueBinding="{Binding id}"                                            
                                           SelectedValuePath="id"
                                           DisplayMemberPath="name"
                                           Header="Name"
                                           ItemsSource="{Binding Source={StaticResource Employees}}">
                    <dg:DataGridComboBoxColumn.EditingElementStyle>
                        <Style TargetType="ComboBox">
                            <Setter Property="IsEditable" Value="True" />
                        </Style>
                    </dg:DataGridComboBoxColumn.EditingElementStyle>
                </dg:DataGridComboBoxColumn>
                
                <dg:DataGridComboBoxColumn SelectedValueBinding="{Binding id}"                                            
                                           SelectedValuePath="id"
                                           DisplayMemberPath="surname"
                                           Header="SurName"
                                           ItemsSource="{Binding Source={StaticResource Employees}}">
                    <dg:DataGridComboBoxColumn.EditingElementStyle>
                        <Style TargetType="ComboBox">
                            <Setter Property="IsEditable" Value="True" />
                        </Style>
                    </dg:DataGridComboBoxColumn.EditingElementStyle>
                </dg:DataGridComboBoxColumn>
            </dg:DataGrid.Columns> 
            
        </dg:DataGrid>
    </Grid>
</UserControl>
